<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>评分组件文档 - layui.rate</title>
	<link rel="stylesheet" href="../libs/layui/layui-2.9.14/dist/css/layui.css">
	<script src="../libs//layui//layui-2.9.14/dist/layui.js"></script>
	<style>


	</style>
</head>

<body style="margin:100px ;">

	<div id="test1"></div>
	<script>
		layui.use('rate', function () {
			var rate = layui.rate;

			//渲染
			var ins1 = rate.render({
				elem: '#test1',  //绑定元素
				length: 10,
				text: true,
				value:3,
				setText: function (value) {
					var arrs = {
						'1': '极差'
						, '2': '差'
						, '3': '中等'
						, '4': '好'
					};
					this.span.text(arrs[value] || (value + "星"));
				},
				choose: function (value) {
					alert(value)
				}
			});
		});
	</script>


</body>

</html>